package tech.lq0.dreamaticvoyage.block.entity;

import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import tech.lq0.dreamaticvoyage.init.BlockEntityRegistry;

public class LightBreadEnergyBlockEntity extends AbstractBreadEnergyBlockEntity {

    public static final int MAX_ENERGY = 100000;
    public static final int MAX_RANGE = 4;
    public static final int TRANSFER_SPEED = 128;
    public static final int MAX_CONNECT_COUNT = 6;

    public LightBreadEnergyBlockEntity(BlockPos pPos, BlockState pBlockState) {
        super(BlockEntityRegistry.LIGHT_BREAD_ENERGY_BLOCK_ENTITY.get(), pPos, pBlockState,
                new Builder().range(MAX_RANGE).capacity(MAX_ENERGY).transferSpeed(TRANSFER_SPEED).maxConnectCount(MAX_CONNECT_COUNT));
    }

    public static void serverTick(Level pLevel, BlockPos pPos, BlockState pState, LightBreadEnergyBlockEntity blockEntity) {
        blockEntity.refreshConnections(pLevel, pPos);
        blockEntity.transferEnergy(pLevel, pPos);
    }

    public static void clientTick(Level pLevel, BlockPos pPos, BlockState pState, LightBreadEnergyBlockEntity blockEntity) {
        blockEntity.refreshConnections(pLevel, pPos);
    }
}
